package com.ecfront.test.dao;

import java.util.Iterator;
import java.util.List;

import com.ecfront.dao.ShopGoodsSortDAO;
import com.ecfront.pojo.Shop;
import com.ecfront.pojo.ShopGoodsSort;

import junit.framework.TestCase;

public class testShopGoodsSort extends TestCase {
	private static final ShopGoodsSortDAO shopGoodsSortDao =  (ShopGoodsSortDAO)SpringUtilTest.getBean("ShopGoodsSortDAO");
	//save or update test
	public void testSaveOrUpdate(){
		ShopGoodsSort sgs = new ShopGoodsSort();
		//sgs.setId(1);
		sgs.setName("个人店铺品牌");
		
		Shop shop = new Shop();
		shop.setId(1);
		sgs.setShop(shop);
		
		shopGoodsSortDao.save(sgs);
	}
	//findall test
	public void testFindAll(){
		List list = shopGoodsSortDao.findAll();
		for(Iterator iter = list.iterator();iter.hasNext();){
			ShopGoodsSort sgs = (ShopGoodsSort)iter.next();
			System.out.println(sgs.getName());
			System.out.println(sgs.getShop().getName());
		}
	}
	//findById test
	public void testFindById(){
		ShopGoodsSort sgs = shopGoodsSortDao.findById(1);
		System.out.println(sgs.getName());
		System.out.println(sgs.getShop().getName());
	}
	//delete test
	public void testDel(){
		ShopGoodsSort sgs = new ShopGoodsSort();
		sgs.setId(2);
		
		shopGoodsSortDao.delete(sgs);
	}
}
